package com.poi.qianmi.jol;

import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.info.GraphLayout;

/**
 * @Classname JolDetection
 * @Description TODO
 * @Date 2019/9/20 10:00 上午
 * @Created by xiaocai
 */
public class JolDetection {
    public static void detection(Object obj) {
//        //查看对象内部信息
//        print(ClassLayout.parseInstance(obj).toPrintable());
//
//        //查看对象外部信息
//        print(GraphLayout.parseInstance(obj).toPrintable());

        //获取对象总大小
        print("size : " + GraphLayout.parseInstance(obj).totalSize());
    }

    static void print(String message) {
        System.out.println(message);
        System.out.println("-------------------------");
    }
}
